<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-do-edit" th:object="${tbUser}">
        <input type="hidden" name="userName" th:value="*{userName}"><!-- 主键 -->
        <div class="form-group">
            <label class="col-sm-3 control-label">密码:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="password" th:value="*{password}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">姓名:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="nickName" th:value="*{nickName}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">电话:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="phone" th:value="*{phone}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">编码:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="identityNum" th:value="*{identityNum}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">地址:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="address" th:value="*{address}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">user普通用户，expert专家，admin管理员 , bank银行用户:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="role" th:value="*{role}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="updateTime" th:value="*{updateTime}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">积分500:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="integral" th:value="*{integral}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">信誉1，2，3，4，5:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="credit" th:value="*{credit}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">头像:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="avatar" th:value="*{avatar}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="realName" th:value="*{realName}"></div>
        </div>
        <div class="form-group">
            <div class="form-control-static col-sm-offset-9">
                <button type="submit" class="btn btn-primary">提交</button>
                <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
            </div>
        </div>
    </form>
</div>
<div th:include="include::footer"></div>
<script th:src="@{/ajax/libs/select/select2.js}"></script>
<script type="text/javascript">
    layui.use('laydate', function () {
        var laydate = layui.laydate;//时间选择器
        laydate.render({
            elem: '#inDate', type: 'date'
        });
    });
    var prefix = "/tbUser"
    $("#form-do-edit").validate({
        rules: {
            userName: {required: true},
        },
        messages: {
            "userName": {remote: "必填"}
        },
        submitHandler: function (form) {
            $.operate.save(prefix + "/editSave", dataEdit());
        }
    });

    function dataEdit() {
        var userName = $("input[name='userName']").val();
        var password = $("input[name='password']").val();
        var nickName = $("input[name='nickName']").val();
        var phone = $("input[name='phone']").val();
        var identityNum = $("input[name='identityNum']").val();
        var address = $("input[name='address']").val();
        var role = $("input[name='role']").val();
        var createTime = $("input[name='createTime']").val();
        var updateTime = $("input[name='updateTime']").val();
        var integral = $("input[name='integral']").val();
        var credit = $("input[name='credit']").val();
        var avatar = $("input[name='avatar']").val();
        var realName = $("input[name='realName']").val();
        return {
            "userName":userName,
            "password":password,
            "nickName":nickName,
            "phone":phone,
            "identityNum":identityNum,
            "address":address,
            "role":role,
            "createTime":createTime,
            "updateTime":updateTime,
            "integral":integral,
            "credit":credit,
            "avatar":avatar,
            "realName":realName,
        }
    }
</script>
</body>
</html>